<template>
  <div class="search animate__animated animate__backInLeft">
    <searchbox @delItem="delsearch" ref="searchbox"></searchbox>
    <searchlist v-show="$store.state.isSearchShow"></searchlist>
    <historyList
      v-if="$store.state.isShow && $store.state.isSearchShow"
      ref="historydata"
    ></historyList>
    <searchRecommend
      v-else-if="!$store.state.isSearchShow && $store.state.isShow"
    ></searchRecommend>
    <newMusic v-else></newMusic>
  </div>
</template>

<script>
import searchbox from "@/components/Search/searchbox.vue/";
import searchlist from "@/components/Search/searchlist.vue/";
import historyList from "@/components/Search/historyList.vue/";
import searchRecommend from "@/components/Search/searchRecommend.vue/";
import newMusic from "@/components/recommend/newMusic.vue";
export default {
  components: {
    searchbox,
    searchlist,
    historyList,
    searchRecommend,
    newMusic,
  },
  data() {
    return {
      isshow: true,
      searchMusicList: [],
    };
  },
  methods: {
    delsearch(data) {
      if (data == 0) {
        this.$store.state.isSearchShow = false;
        this.$store.state.isShow = false;
        this.$store.commit("changeSearchWorld", "");
      } else {
        this.$store.state.isSearchShow = true;
        this.$store.state.isShow = true;
        this.$store.commit("changeSearchWorld", "");
      }
    },
  },
  destroyed() {
    this.$store.state.isSearchShow = true;
    this.$store.state.isShow = true;
    this.$store.commit("changeSearchWorld", "");
  },
};
</script>

<style>
</style>